package com.longshihan.module_main;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Autowired;
import com.alibaba.android.arouter.facade.annotation.Route;
import com.alibaba.android.arouter.launcher.ARouter;
import com.longshihan.mvplh.utils.ArouterUtil;
import com.orhanobut.logger.Logger;

@Route(path = "/main/MainActivity", extras = ArouterUtil.EXTRA)
public class MainActivity extends AppCompatActivity {
    @Autowired
    public String name;
    @Autowired
    int age;
    @Autowired(name = "girl") // 通过name来映射URL中的不同参数
            boolean boy;


    TextView mTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main_module1);
        ARouter.getInstance().inject(this);
        mTextView = (TextView) findViewById(R.id.eedd);
        Logger.d("param:" + name + age + boy);

        PollingUtils.startPollingService(this, 5, PollingService.class, PollingService.ACTION);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        //Stop polling service
        System.out.println("Stop polling service...");
        PollingUtils.stopPollingService(this, PollingService.class, PollingService.ACTION);
    }
}
